<template>
	<view class="container">
		<view class="flex-fill overflow-hidden">
			<view class="content" v-if="!scores.length">
				<view class="flex-fill d-flex align-items-center just-content-center">
					暂无积分记录
				</view>
			</view>
			<scroll-view class="content" scroll-y v-else>
				<block v-for="(item, index) in scores" :key="index">
					<list-cell v-if="item.refund_id">
						<view class="score">
							<view class="left">
								<view class="title mb-10">保证金退款</view>
								<view class="mb-10">退款单号:{{item.refund_id}}</view>
								<view>退款时间:{{item.refund_success_time}}</view>
							</view>
							<view class="right">-{{item.refund_fee}}</view>
						</view>
					</list-cell>
					<list-cell>
						<view class="score">
							<view class="left">
								<view class="title mb-10">支付保证金</view>
								<view class="mb-10">支付单号:{{item.transaction_id}}</view>
								<view>支付时间:{{item.paid_at}}</view>
							</view>
							<view class="right">+{{item.total_fee}}</view>
						</view>
					</list-cell>
				</block>
				
			</scroll-view>
		</view>
	</view>
</template>

<script>
	import listCell from '@/components/list-cell/list-cell.vue'
	export default {	
		components: {
			listCell
		},
		data() {
			return {
				scores: [],
				loading: false
			}
		},
		async onLoad() {
			this.getList();
		},
		methods:{
			getList() {
				uni.showLoading({
					mask: true,
					title: '加载中...'
				});
				this.scores = [];
				uni.hideLoading();
			}
		}
	}
</script>

<style lang="scss" scoped>
	page {
		height: 100%;
	}
	
	.container {
		width: 100%;
		display: flex;
		flex-direction: column;
	}
	
	.header {
		margin-bottom: 20rpx;
		background-color: $bg-color-white;
		width: 100%;
		flex-shrink: 0;
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
		padding: 30rpx 40rpx;
		font-size: $font-size-medium;
		color: $text-color-base;
		
		.value {
			font-size: 64rpx;
			color: $color-primary;
			font-weight: 500;
			margin-bottom: 30rpx;
		}
		
		.rules {
			width: 100%;
			display: flex;
			justify-content: flex-end;
			align-items: center;
			
			.rules-icon {
				width: 32rpx;
				height: 32rpx;
				margin-right: 10rpx;
			}
		}
	}
	
	.content {
		width: 100%;
		height: 100%;
		background-color: $bg-color-white;
		display: flex;
		flex-direction: column;
		
		.top {
			padding: 20rpx 30rpx;
			font-size: $font-size-lg;
			font-weight: 500;
		}
		
		.score {
			width: 100%;
			display: flex;
			justify-content: space-between;
			align-items: center;
			
			.left {
				flex: 1;
				display: flex;
				flex-direction: column;
				font-size: $font-size-sm;
				color: $text-color-assist;
				
				.title {
					font-size: $font-size-lg;
					color: $text-color-base;
					margin-bottom: 10rpx;
				}
			}
			
			.right {
				font-size: $font-size-lg;
				color: $color-primary;
			}
		}
	}
</style>
